<template>
    <div id="list">
        <ul style="padding-left: 0px;height:446px;overflow-y:scroll">
            <li v-for="item in admins"
                :class="{ active:CurrentSession? item.username === CurrentSession.username:false}"
                v-on:click="changeCurrentSession(item)">
                <el-badge :is-dot = "isDot[user.username+'#'+item.username]"><p class="name">{{item.userNameCn}}</p></el-badge>
            </li>
        </ul>
    </div>
</template>

<script>
    import { mapState } from 'vuex'

    export default {
        name: 'list',
        data () {
            return {
                user:JSON.parse(window.sessionStorage.getItem('user'))
            }
        },
        computed: mapState([
            'isDot',
            'admins',
            'CurrentSession'
        ]),
        methods: {
            changeCurrentSession: function (CurrentSession) {
                this.$store.commit('changeCurrentSession', CurrentSession)
            }
        }
    }
</script>

<style lang="scss" scoped>
    #list {
        li {
            padding: 15px 15px;
            border-bottom: 1px solid #292C33;
            cursor: pointer;

            &:hover {
                background-color: rgba(255, 255, 255, 0.03);
            }
        }

        li.active { /*注意这个是.不是冒号:*/
            background-color: rgba(255, 255, 255, 0.1);
        }

        .avatar {
            border-radius: 2px;
            width: 30px;
            height: 30px;
            vertical-align: middle;
        }

        .name {
            display: inline-block;
            margin-left: 15px;
            margin-top: 0px;
            margin-bottom: 0px;
        }
        ::-webkit-scrollbar {
            width: 5px;
            height: 14px;
        }

        ::-webkit-scrollbar-thumb {
            /* background-color: #01c8dc;
            border-radius: 3px; */
            background-color: #b6b6b6;
        }
    }
</style>
